<?
if(isset($_POST['libraries'])){
    $versions=array();
    ob_start();
    $f=fopen("http://download.symbiosis.webex.am/libraries.php", "r");
    $ob=ob_get_clean();
    if($ob){
        print('{"error":"File not exists."}');
        exit();
    }
    $content='';
    while($buf=fread($f, 8192)){
        $content.=$buf;
    }
    $json=json_decode($content);

    foreach($_POST['libraries'] as $lib){
        if(!preg_match("/[a-zA-Z0-9_]/", $lib)){
            print('{"error":"Library name incorrect."}');
            exit();
        }
        if(isset($json->$lib)) $versions[]=$json->$lib;
        else $versions[]='0.0.0';
        
    }
    print json_encode($versions);
}
?>